package com.contacts.service;

import java.sql.SQLException;
import java.util.List;

import com.contacts.dao.ContactDao;
import com.contacts.pojo.Contact;

public class ContactService {
	//查找所有人
	public List<Contact> findAllContact() throws SQLException {
		ContactDao dao=new ContactDao();
		List<Contact> list = dao.findAllContact();
		return list;
	}
	public int addContact(Contact contact) throws SQLException {
		ContactDao dao=new ContactDao();
		int i = dao.addContactDao(contact);
		return i;
	}
	
	public Contact findContactById(String id) throws SQLException {
		ContactDao dao=new ContactDao();
		return dao.findContactByIdDao(id);
	}
	public int updateContact(Contact contact) throws SQLException {
		ContactDao dao=new ContactDao();
		int i = dao.updateContactDao(contact);
		return i;
	}
	public int deleteContactById(String id) throws SQLException {
		ContactDao dao=new ContactDao();
		return dao.deleteContactByIdDao(id);
	}
}
